package com.carreirati.evaluation.domain;

import java.util.List;
import org.springframework.roo.addon.dbre.RooDbManaged;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.json.RooJson;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooJpaActiveRecord(identifierType = VwGetEvaluationResultsByQuestionPK.class, versionField = "", table = "vw_get_evaluation_results_by_question", schema = "dbo")
@RooDbManaged(automaticallyDelete = true)
@RooJson
public class VwGetEvaluationResultsByQuestion {

    public static long countVwGetEvaluationResultsByQuestions() {
        return entityManager().createQuery("SELECT COUNT(*) FROM VwGetEvaluationResultsByQuestion o", Long.class).getSingleResult();
    }

    public static List<com.carreirati.evaluation.domain.VwGetEvaluationResultsByQuestion> findAllVwGetEvaluationResultsByQuestions() {
        return entityManager().createNativeQuery("SELECT * FROM Vw_Get_Evaluation_Results_By_Question o ORDER BY  ORDER BY appraisal_id, knowledge_area,question", VwGetEvaluationResultsByQuestion.class).getResultList();
    }

    public static List<com.carreirati.evaluation.domain.VwGetEvaluationResultsByQuestion> findAllVwGetEvaluationResultsByQuestions(Long appraisalId) {
        return entityManager().createNativeQuery("SELECT * FROM Vw_Get_Evaluation_Results_By_Question WHERE appraisal_Id = '" + appraisalId + "' ORDER BY knowledge_area,question", VwGetEvaluationResultsByQuestion.class).getResultList();
    }
}
